package core.social
{
import core.Configuration;

import flash.utils.getDefinitionByName;

import utils.JavascriptAPI;

/**
 * 社交网络服务 
 * @author jliang
 * 
 */
public class SocialService
{
	private static var service:ISocialService;
	
	social_ns static function setService(value:ISocialService):void
	{
		service = value;
		value.initialize();
	}
	
	public static function get instance():ISocialService
	{
		return service;
	}
	
	public static function initialize():void
	{
		CONFIG::debugging
		{			
			social_ns::setService(new DebugSocialService());
		}
		CONFIG::release
		{						
			if (JavascriptAPI.JS_ENABLED) 
			{
				var ref:String = Configuration.getSocialServiceClassRef();
				
				var classRef:Class = getDefinitionByName(ref) as Class;
				
				social_ns::setService(new classRef());
			}
			else
			{
				social_ns::setService(new DebugSocialService());
			}
		}
	}
	
}
}